import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.AES;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.google.gson.Gson;
import com.ruoyi.business.domain.CivilServants;
import com.ruoyi.business.domain.vo.ResumeVo;
import com.ruoyi.business.service.CivilServantsService;
import com.ruoyi.common.utils.sign.Md5Utils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.User;

import javax.annotation.Resource;
import java.util.*;

import static cn.hutool.crypto.CipherMode.encrypt;
import static com.ruoyi.business.utils.RSAUtil.*;

public class test {

    @Test
    public void SecureUtilTest() {
       String str="83BB04BB80A7FC3F21A11807E9857EC5E2E0C2CC04A54DD9169F7D15568F98D6CDAD9B553A61D4192F4962116266F53721C1FE10B8DFAC740932C89CE2E4D263CC67F49DA73274E8956A3DEC092372901DC330E98EF0B0205C087C26EAA624702EB58B3B3D60BE44D6EDA29DA257818348350F2905FC1F0DBEC899ED056B3E4D";
//        System.out.println(encrypt(str));

//        System.out.println(decrypt(encrypt(str)));
        System.out.println(decrypt(str));
    }


    @Test
    public void md5() {
        String str="83BB04BB80A7FC3F21A11807E9857EC5E2E0C2CC04A54DD9169F7D15568F98D6CDAD9B553A61D4192F4962116266F53721C1FE10B8DFAC740932C89CE2E4D263CC67F49DA73274E8956A3DEC092372901DC330E98EF0B0205C087C26EAA624702EB58B3B3D60BE44D6EDA29DA257818348350F2905FC1F0DBEC899ED056B3E4D";

    }


    @Resource
    CivilServantsService civilServantsService;

    @Test
    public void export(){

        String test = "C:\\Users\\wgtz\\Desktop\\test.xlsx";

        List<CivilServants> civilServantsList = new ArrayList<>();


        // 创建ExcelWriter对象
        ExcelWriter excelWriter = EasyExcel.write(test, CivilServants.class).build();
        // 创建Sheet对象
        WriteSheet writeSheet = EasyExcel.writerSheet("公务员信息").build();
        // 向Excel中写入数据
        excelWriter.write(civilServantsList, writeSheet);
        // 关闭流
        excelWriter.finish();
    }



//    @Test
//    public void getResume(){
//        ResumeVo resume = civilServantsService.getResume(110L);
//        System.out.println(resume);
//    }

    @Test
    public void json(){
        String json = generateJson();
        System.out.println(json);
    }

    public static String generateJson() {
        // 创建包含数据的列表
        List<Map<String, Object>> data = new ArrayList<>();
        data.add(createDataMap("本科", 1048));
        data.add(createDataMap("其他", 735));
        data.add(createDataMap("硕士", 580));
        data.add(createDataMap("博士", 484));

        // 使用Gson将列表转换为JSON字符串
        Gson gson = new Gson();
        String json = gson.toJson(data);

        return json;
    }

    private static Map<String, Object> createDataMap(String name, int value) {
        Map<String, Object> map = new HashMap<>();
        map.put("name", name);
        map.put("value", value);
        return map;
    }
}




